﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace GSM900A.Models
{
    public class Logger
    {
        public ObservableCollection<string> Logs { get; set; } = new ObservableCollection<string>();
        public Logger()
        {

        }
        public void WriteLog(string message)
        {
            WriteToView(message);
        }
        public void WriteToView(string message)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                Logs.Add(message);
            });
        }
        public void WriteLogAsync(string message)
        {
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                WriteLog(message);
            }));
        }
    }
}
